Skip to content

docs(router): add File Inputs and Web Fetch feature pages - #433

Open
gaoteng-git wants to merge 2 commits into
0gfoundation:mainfrom
gaoteng-git:docs/router-file-inputs-web-fetch
Open

gaoteng-git wants to merge 2 commits into
0gfoundation:mainfrom
gaoteng-git:docs/router-file-inputs-web-fetch

Conversation

@gaoteng-git

@gaoteng-git gaoteng-git commented Oct 28, 2026 •

Copy link
Copy Markdown

What changed

  • New page router/features/file-inputs.md. Covers attaching files inline on POST /v1/chat/completions ({"type":"file"}) and POST /v1/messages ({"type":"document"}, base64 source):
    • when the provider reads files itself, the file is forwarded as sent;
    • otherwise the Router extracts the text of PDFs (text layer) and UTF-8 text files and reports "file_parse" in x_0g_trace.request_rewritten;
    • limits: 20 files, 200,000 bytes of text per file, 20 MB body;
    • the five 400 codes;
    • no file fee.
  • New page router/features/web-fetch.md. Covers the {"type":"0g:web_fetch"} tool:
    • options: max_uses, max_content_tokens, allowed_domains, blocked_domains, and the openrouter:web_fetch form;
    • the round loop with its 5-round cap, fetch failures going back to the model, your own tools alongside it, and streaming behaviour;
    • billing: $0.001 per page, web_fetch_cost, and the per-round -wfN usage entries.
  • features/chat-completions.md: a pointer to each page.
  • sidebars.ts: added both pages under Router › Features.

The style follows the open Web Search page (#421). The two pages do not link to it, so the build does not depend on #421 being merged.

Verification

  • Every example ran as written against staging, with only the host and the key changed:
    • chat + txt file: 200, correct answer, request_rewritten: ["file_parse"]
    • messages + txt document: 200, correct answer, request_rewritten: ["file_parse"]
    • chat + web fetch: 200, correct answer, web_fetch_cost: "2000" (2 pages)
    • messages + web fetch: 200, correct answer, web_fetch_cost: "2000" (2 pages)
  • Error codes and envelopes were spot-checked on staging: unsupported_file_type on chat, and unsupported_file_source on messages.
  • Every statement was reviewed against the 0g-router source on main in two rounds. The last round found nothing at HIGH or MEDIUM.
  • pnpm build and cspell pass.

Before merging

Both features are on in staging only. On mainnet, features.file_parts, features.web_fetch_tool and search.fetch_price_usd are not set yet; the page price is $0.001 on staging. Merge this PR after mainnet turns the flags on, and check that the mainnet page price matches the $0.001 stated here.

Deliberately left out

  • /v1/responses (input_file): the Responses API is not documented publicly.
  • Sealed (E2EE) requests.
  • The fetch backend, and rare edge cases.

🤖 Generated with Claude Code


This change is Reviewable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 28, 2026

Copy link
Copy Markdown

@gaoteng-git-0g is attempting to deploy a commit to the 0g-Frontend Team on Vercel.

A member of the Team first needs to authorize it.

…e inputs

Requests to 0gm-1.0-35b-a3b and glm-5.3 are sealed by the E2EE gateway
before they reach the Router, so the Router cannot extract a file's text
and the provider rejects the unconverted file part with a 400.

Refs 0gfoundation/0g-router#1196.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants